<?php
include("include/haut.php");

if(!isConnected() && estAdmin(getInfos($_SESSION['id']))){
	header("Location: index.php");
	exit();
}
$news = getNews();
?>

<div id="corps">
	<h1>Gestion des news</h1>
	<div id="centre">
		<table style="width: 100%">
			<a href="edit_news.php">Ajouter une news</a>
			<tr>
				<th>Titre</th>
				<th>Auteur</th>
				<th>Date</th>
				<th>Action</th>

			</tr>

				<?php while($a= mysql_fetch_array($news)){
					?> <tr><?php
					echo"<td>".$a['titre']."</td>";
					echo"<td>".getPseudoID($a['auteur'])."</td>";
					echo"<td>".date("d/m/y à H:i",$a['date'])."</td>";
					?>
					<td>
						<a href="edit_news.php?action=maj&id=<?php echo $a['id']; ?>"> <img src="img/misc/mini_edit.png"/> </a>

						<a href="edit_news.php?action=remove&id=<?php echo $a['id']; ?>"> <img src="img/misc/sign_remove.png"/> </a>
					</td>
					<tr>
					<?php
				}
?>
		
		<?php
		?>
	</table>
	</div>
</div>
<?php
include("include/bas.php");
?>
